#!/usr/bin/python
# --coding:utf-8--


import requests

url = "https://music.163.com/weapi/cloudsearch/get/web?csrf_token="
'''

        https://music.163.com/weapi/cloudsearch/get/web?csrf_token=baace3cd79d6aa7badda52424a19c913
'''

headers = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
}
data = {
    "params": "XjnUXS27M7NbAkmYkqhjokABiFO3o33fo+XXJM6EgWI0uGblh5vCpMfhLUao2a0SrdFAHy9LsQZbe63GkRDWZXbhoIzAO5sNU89j90VQMPsAHF4D5kumHaoGMmGot3mrYn6UXX5SdCJDRrm5frehLAmsJOWyHa293d4lZCSqh0n7q+P6JhQvqVmvGL0dtLnVh/8fxI2RbzWAuyoXRUOcYzcJWBUBBA5jIluDeDHDe3SaK4voe+D6S3IHZmuflAQ9QDRjhwYDBUFnpbP0IhK0Hw==",
    "encSecKey": "348ea63e4e5d12104b26fb72c5cc916054824424cd1862b69f18aaaa467e4234147dbbffff1ff357d40506a5b8c1b6386b1c254d39c268b657017e5cf441250eae25f75b0b8e2adea4de8d014bb60327b88baa586a2b43471dfdd793d97f498c4f90af1098bfd8edb998448387113ac3a2301f221dc62575aac27f149f138e45"
}

# 利用requests对象的post方法，对指定的url发起请求
# 该方法会返回一个Response对象
res = requests.post(url, headers=headers, data=data)
print(res)
# 通过Response对象的text方法获取网页的文本信息
print(res.text)

save_file = 'music.txt'
with open(save_file, 'w', encoding='utf-8') as file:
    file.write(res.text)
    print('保存成功！')
